/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import javax.swing.JOptionPane;

/**
 *
 * @authors Matías Barrera G. Luis Castillo S.
 */
public class MDIPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form MDIPrincipal
     */
    public MDIPrincipal() {
        //String clave = JOptionPane.showInputDialog("clave maestra");
        initComponents();
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jScrollTabla = new javax.swing.JScrollPane();
        jTabla = new javax.swing.JTable();
        jScrollGrupos = new javax.swing.JScrollPane();
        GruposTree = new javax.swing.JTree();
        BarraMenu = new javax.swing.JMenuBar();
        Archivo = new javax.swing.JMenu();
        CrearClaveMaestra = new javax.swing.JMenuItem();
        Salir = new javax.swing.JMenuItem();
        GrupoYClaves = new javax.swing.JMenu();
        NuevoGrupo = new javax.swing.JMenuItem();
        NuevaClave = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTabla.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollTabla.setViewportView(jTabla);

        jScrollTabla.setBounds(100, 0, 330, 320);
        jDesktopPane1.add(jScrollTabla, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Grupos");
        javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Grupo1");
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Grupo2");
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Grupo3");
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Grupo4");
        treeNode1.add(treeNode2);
        GruposTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        jScrollGrupos.setViewportView(GruposTree);

        jScrollGrupos.setBounds(0, 0, 100, 320);
        jDesktopPane1.add(jScrollGrupos, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Archivo.setText("Archivo");

        CrearClaveMaestra.setText("Crear Clave Maestra");
        CrearClaveMaestra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CrearClaveMaestraActionPerformed(evt);
            }
        });
        Archivo.add(CrearClaveMaestra);

        Salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        Salir.setText("Salir");
        Salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SalirActionPerformed(evt);
            }
        });
        Archivo.add(Salir);

        BarraMenu.add(Archivo);

        GrupoYClaves.setText("Grupo y Claves");

        NuevoGrupo.setText("Nuevo Grupo");
        NuevoGrupo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NuevoGrupoActionPerformed(evt);
            }
        });
        GrupoYClaves.add(NuevoGrupo);

        NuevaClave.setText("Nueva Clave");
        NuevaClave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NuevaClaveActionPerformed(evt);
            }
        });
        GrupoYClaves.add(NuevaClave);

        BarraMenu.add(GrupoYClaves);

        setJMenuBar(BarraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CrearClaveMaestraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CrearClaveMaestraActionPerformed
        JIFClaveMaestra clv = new JIFClaveMaestra();
        jDesktopPane1.add(clv);
        clv.setVisible(true);
    }//GEN-LAST:event_CrearClaveMaestraActionPerformed

    private void SalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalirActionPerformed
        System.exit(0);
    }//GEN-LAST:event_SalirActionPerformed

    private void NuevoGrupoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NuevoGrupoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_NuevoGrupoActionPerformed

    private void NuevaClaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NuevaClaveActionPerformed
        JIFNuevaClave nvc = new JIFNuevaClave();
        jDesktopPane1.add(nvc);
        nvc.setVisible(true);
    }//GEN-LAST:event_NuevaClaveActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MDIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MDIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MDIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MDIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MDIPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Archivo;
    private javax.swing.JMenuBar BarraMenu;
    private javax.swing.JMenuItem CrearClaveMaestra;
    private javax.swing.JMenu GrupoYClaves;
    private javax.swing.JTree GruposTree;
    private javax.swing.JMenuItem NuevaClave;
    private javax.swing.JMenuItem NuevoGrupo;
    private javax.swing.JMenuItem Salir;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JScrollPane jScrollGrupos;
    private javax.swing.JScrollPane jScrollTabla;
    private javax.swing.JTable jTabla;
    // End of variables declaration//GEN-END:variables
}